package com.party.core.service.commune.impl;

import com.party.common.paging.Page;
import com.party.core.dao.read.commune.CRouteInfoReadDao;
import com.party.core.dao.write.commune.CRouteInfoWriteDao;
import com.party.core.model.BaseModel;
import com.party.core.model.commune.CRouteInfo;
import com.party.core.service.commune.ICRouteInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * 会员到路线的起始点距离和时间服务接口实现
 * @Date: 2019/10/22 15:32
 */
@Service
public class CRouteInfoService implements ICRouteInfoService {

    @Autowired
    private CRouteInfoWriteDao cRouteInfoWriteDao;

    @Autowired
    private CRouteInfoReadDao cRouteInfoReadDao;

    @Override
    public String insert(CRouteInfo cRouteInfo) {
        BaseModel.preInsert(cRouteInfo);
        boolean result = this.cRouteInfoWriteDao.insert(cRouteInfo);
        if (result)
        {
            return cRouteInfo.getId();
        }
        return null;
    }

    @Override
    public boolean update(CRouteInfo cRouteInfo) {
        return this.cRouteInfoWriteDao.update(cRouteInfo);
    }

    @Override
    public boolean deleteLogic(String id) {
        return this.cRouteInfoWriteDao.deleteLogic(id);
    }

    @Override
    public boolean delete(String id) {
        return this.cRouteInfoWriteDao.delete(id);
    }

    @Override
    public boolean batchDeleteLogic(Set<String> ids) {

        return this.cRouteInfoWriteDao.batchDeleteLogic(ids);
    }

    @Override
    public boolean batchDelete(Set<String> ids) {
        return this.cRouteInfoWriteDao.batchDelete(ids);
    }

    @Override
    public CRouteInfo get(String id) {
        return this.cRouteInfoReadDao.get(id);
    }

    @Override
    public List<CRouteInfo> listPage(CRouteInfo cRouteInfo, Page page) {
        return null;
    }

    @Override
    public List<CRouteInfo> list(CRouteInfo cRouteInfo) {
        return null;
    }

    @Override
    public List<CRouteInfo> batchList(Set<String> ids, CRouteInfo cRouteInfo, Page page) {
        return null;
    }

    @Override
    public boolean batchInsert(List<CRouteInfo> cRouteInfoList) {
        return this.cRouteInfoWriteDao.batchInsert(cRouteInfoList);
    }

    @Override
    public List<CRouteInfo> webListPage(Map<String, Object> params, Page page) {

        return this.cRouteInfoReadDao.webListPage(params,page);

    }

    @Override
    public List<CRouteInfo> getMemberListPage(Map<String, Object> params, Page page) {
        return this.cRouteInfoReadDao.getMemberListPage(params,page);
    }

    @Override
    public List<CRouteInfo> routeInfoMobileList(Map<String, Object> params, Page page) {
        return this.cRouteInfoReadDao.routeInfoMobileList(params,page);
    }

    @Override
    public Map<String, Object> avgDistanceAndTime(Map<String, Object> params) {
        return this.cRouteInfoReadDao.avgDistanceAndTime(params);
    }

    @Override
    public Boolean deleteByRouteId(String cRouteId) {
        return this.cRouteInfoWriteDao.deleteByRouteId(cRouteId);
    }

    @Override
    public Long getDataTotalByRouteId(String routeId) {
        return this.cRouteInfoReadDao.getDataTotalByRouteId(routeId);
    }

    @Override
    public List<CRouteInfo> getDetailRouteList(Map<String, Object> params) {
        return this.cRouteInfoReadDao.getDetailRouteList(params);
    }

    @Override
    public List<CRouteInfo> getRouteByMemberIdAndRouteId(String routeId, String memberId) {
        return this.cRouteInfoReadDao.getRouteByMemberIdAndRouteId(routeId,memberId);
    }

    @Override
    public CRouteInfo getRouteInfoOne(Map<String, Object> params) {
        return cRouteInfoReadDao.getRouteInfoOne(params);
    }
}
